<?php

function smarty_function_get_subcategory_by_id($params, &$smarty)
{
  $subcat_id = $params['subcat_id'];
      $pntables = pnDBGetTables();

  if(isset($subcat_id)){
    //Query data
    $sql = "SELECT
              sct_name
            FROM ".
              $pntables[innoadvert_subcategories]
            ." WHERE
              sct_id = ".$subcat_id;

    $column = array("name");
    $result = DBUtil::executeSQL($sql);
    $objectArray = DBUtil::marshallObjects ($result, $column);
    $smarty->assign("subcat_name", $objectArray[0]['name']);
    //return $objectArray[0]['name'];
  }
}
